local thbattle__huiye_nanti = fk.CreateSkill {

  name = "thbattle__huiye_nanti",

  tags = {  },

}



thbattle__huiye_nanti:addEffect(fk.HpRecover, {
  anim_type = "special",
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(thbattle__huiye_nanti.name) then
      return data.recoverBy
    end
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    return room:askForSkillInvoke(player, thbattle__huiye_nanti.name, nil,
        "#thbattle__huiye_nanti-HpRecover:" .. data.recoverBy.id .. "::" .. data.num)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    data.recoverBy:drawCards(data.num, thbattle__huiye_nanti.name)
  end
})
thbattle__huiye_nanti:addEffect(fk.Damaged, {
  anim_type = "special",
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(thbattle__huiye_nanti.name) then
       return data.from
    end
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    return room:askForSkillInvoke(player, thbattle__huiye_nanti.name, nil, "#thbattle__huiye_nanti-Damaged:" .. data.from.id)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local choice_card = room:askForCard(data.from, 1, 1, true, thbattle__huiye_nanti.name, true, ".|.|diamond",
        "#thbattle__huiye_nanti-choose_card:" .. player.id)
      if #choice_card > 0 then
        room:obtainCard(player, choice_card, true, fk.ReasonGive, player, thbattle__huiye_nanti.name)
      else
        room:loseHp(data.from, 1, thbattle__huiye_nanti.name)
      end
  end
})

return thbattle__huiye_nanti